//
//  HDGlobalFilterView.h
//  HDUIKit
//
//  Created by HaoDong chen on 2019/5/24.
//  Copyright © 2019 dong rights reserved.
//

#import <UIKit/UIKit.h>
#import <HDCollectionView/HDCollectionView.h>

NS_ASSUME_NONNULL_BEGIN
#define HDGlobalFilterView_New [[HDGlobalFilterView alloc] initWithFrame:CGRectZero]
//自定义的cell需要继承自HDGlobalFilterViewCell,才能获取cell点击回调事件
@interface HDGlobalFilterViewCell : HDCollectionCell
@end

@interface HDGlobalFilterView : UIView
@property (nonatomic, assign, readonly) BOOL isShow;
@property (nonatomic, strong, readonly) HDCollectionView *hdCollectionV;
@property (nonatomic, weak) UIView *showInView; // 默认keyWindow

/**
 下拉筛选view
 
 @param secArr 数据源
 @param refView 参考哪个view的frame
 @param offset 针对参考frame的偏移
 @param size view大小(如果想高度自适应，高度传0)
 @param bottomMinGap 自适应时，当条件过多时高度过高，一般底部需要保留最小间距，其余滑动展示
 @param duration 动画时间
 */
- (void)showWithSecArr:(NSMutableArray<HDSectionModel*>*)secArr
         referenceView:(UIView*)refView
                offset:(CGPoint)offset
                  size:(CGSize)size
          bottomMinGap:(CGFloat)bottomMinGap
     animationDuration:(CGFloat)duration;

- (void)showWithSecArr:(NSMutableArray<HDSectionModel*>*)secArr
         referenceView:(UIView*)refView
                offset:(CGPoint)offset
                  size:(CGSize)size
          bottomMinGap:(CGFloat)bottomMinGap
     animationDuration:(CGFloat)duration
         bottomCornerR:(CGFloat)bottomCornerR;

/*
 上拉筛选view,固定从屏幕最底部弹出
 */
- (void)showWithSecArr:(NSMutableArray<HDSectionModel*>*)secArr
                  size:(CGSize)size
          topMinGap:(CGFloat)topMinGap
       topCornerRadius:(CGFloat)cornerR
     animationDuration:(CGFloat)duration;

- (void)setSelectCallback:(void(^)(__kindof HDCellModel *backModel))callback;
- (void)setInnerHideCallback:(void(^)(void))innerHideCb;
- (void)hide:(BOOL)animated;
- (void)setTopBgColor:(nullable UIColor*)topBgColor bottomBgColor:(nullable UIColor*)bottomBgColor;
- (void)setListViewBgColor:(nullable UIColor*)bgColor cornerR:(CGFloat)corR borderColor:(nullable UIColor*)borderC;
- (void)setIsNeedTapBgAutoHide:(BOOL)tapBgAutoHide; // 点击背景关闭弹框, 默认YES
- (void)setIsNeedTapCellAutoHide:(BOOL)tapCellAutoHide; // 点击cell关闭弹框, 默认YES

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

@end

NS_ASSUME_NONNULL_END

